#!/bin/sh

hostname=`hostname`
if [ "$hostname" = "macmini.local" ]; then
	echo "start memcached"
	sudo -u tsunade memcached -m 64m -d
else
	echo "skip memcached"
	echo "start d-actor with port 8080"
	konoha -a2 --logcached=192.168.0.201:11211 server.k &
fi

konohaid=$!

if [ "$hostname" = "web1" ]; then
	echo $konohaid
	echo -17 > /proc/$konohaid/oom_adj
fi

#echo "recovery"
#konoha -a2 -p50001 &
#
#echo "start fault injection server"
#konoha -a2 -p50010 &
#konoha -a2 -p50011 &
#konoha -a2 -p50012 &
#konoha -a2 -p50013 &
#konoha -a2 -p50014 &
#
#echo "start monitors"
#konoha -a2 -p50020 &
#konoha -a2 -p50021 &
#konoha -a2 -p50022 &
#
#konoha -a2 -p50030 &
#konoha -a2 -p50031 &
#konoha -a2 -p50032 &
#konoha -a2 -p50033 &
#
##echo "start monitor_cpu_usage(web) (port 50041)"
#konoha -a2 -p50041 &
#konoha -a2 -p50042 &
#
#echo "start service initiate server"
#konoha -a2 -p50050 &
#konoha -a2 -p50051 &
#konoha -a2 -p50052 &
